package com.example.springboot.mapper;

import com.example.springboot.entity.Follow;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface FollowMapper {
    @Select("select id,follow_id as followId,followed_id as followedId,update_time as updateTime,is_follow as isFollow from user_follows where follow_id = #{followId} and followed_id = #{followedId}")
    Follow isEmpty (Follow follow);
    @Insert("insert into user_follows(follow_id,followed_id,is_follow) values(#{followId},#{followedId},#{isFollow})")
    void insertFollow(Follow follow);
    @Update("update user_follows set is_follow = #{isFollow} where follow_id = #{followId} and followed_id = #{followedId}")
    void updateFollow(Follow follow);
}
